<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/main.css">
    <style>
        .box {
            width: 300px;
            height: 200px;
            border: 10px solid;
            padding: 10px;
            background: yellowgreen;
            background-clip: content-box;
            box-sizing: content-box;
            /* box-sizing: border-box; */
        }
    </style>
</head>

<body>
    <div id="box" class="box">hello jack</div>
    <script>
        const box = document.getElementById('box');

        console.log(box.offsetWidth);// 外宽
        console.log(box.offsetHeight);// 外高

        // const style = getComputedStyle(box);
        // console.log(style.width);
        // console.log(style.height);
    </script>
</body>

</html>